NodeAdd Method

Adds a Node object to the referenced TreeView control. This method allows all properties to be set in one call and optionally return the created Node object.

Syntax

object.NodeAdd(vRelative, eRelationship, sText, vImage, vSelectedImage, vTag, bBold, bChecked, bEnsureVisible, bExpanded, bSelected, bSorted, lForeColor, lBackColor, vExpandedImage)

The NodeAdd Method syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
vRelative Optional. The index number or key of a pre-existing Node object. The relationship between the new Node and this pre-existing Node is found in the next argument, relationship.
eRelationship Optional. Specifies the relative placement of the Node object, as described in Settings.
sKey Optional. A unique string that can be used to retrieve the Node with the Item (Nodes object in the referenced Treeview control) method.
sText Required. The string that appears in the Node.
vImage Optional. The index of an image in an associated ImageList control (linked to the referenced Treeview control).
vSelectedImage Optional. The index of an image in an associated ImageList control (linked to the referenced Treeview control) that is shown when the Node is selected.
vTag Optional. A string expression identifying the object. The default is a zero-length string ("").
bBold Optional. A Boolean expression specifying if the text is bold, as described in Settings.
bChecked Optional. A Boolean expression specifying if an item is checked, as described in Settings.
bEnsureVisible Optional. Ensures the specified Node object is visible. If necessary, this method expands Node objects and scrolls the referenced TreeView control.
bExpanded Optional. A Boolean expression that specifies whether the Node is expanded or collapsed, as described in Settings.
bSelected Optional. A Boolean expression that determines if a Node object is selected, as described in Settings.
bSorted Optional. A Boolean expression specifying whether the Node objects are sorted, as described in Settings.
lForeColor Optional. A value or constant that determines the background colour of an object, as described in Settings.
lBackColor Optional. A value or constant that determines the background colour of an object, as described in Settings.
vExpandedImage Optional. The index of an image in an associated ImageList control (linked to the referenced Treeview control) that is shown when the Node is expanded.

Settings

The settings for eRelationship operator are:

Constant Setting Description
tvwFirst 0 First. The Node is placed before all other nodes at the same level of the node named in relative.
tvwLast 1 Last. The Node is placed after all other nodes at the same level of the node named in relative. Any Node added subsequently may be placed after one added as Last.
tvwNext 2 (Default) Next. The Node is placed after the node named in relative.
tvwPrevious 3 Previous. The Node is placed before the node named in relative.
tvwChild 4 Child. The Node becomes a child node of the node named in relative.

The settings for bBold operator are:

Setting Description
True The Node object Text is bold.
False The Node object Text is not bold.

The settings for bChecked operator are:

Setting Description
True The Node object is not checked.
False The Node object is checked.

The settings for bEnsureVisible operator are:

Setting Description
True TreeView control must scroll and/or expand to expose the Node object.
False (Default) The Node object may not be displayed when created.

The settings for bExpanded operator are:

Setting Description
True The Node is created expanded.
False (Default) The Node is created collapsed.

The settings for bSelected operator are:

Setting Description
True The Node is selected when created.
False (Default) The Node is not selected when created.

The settings for bSorted operator are:

Setting Description
True The Node is sorted when created.
False (Default) The Node is not sorted when created.

The settings for bBackColor, lForeColor operators are:

Setting Description
Normal RGB colors Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors Colors specified by system color constants listed in the Visual Basic (VB) object library in the Object Browser. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

Remarks